<?php
namespace  app\service;
use app\common\model\MallConfig;
use app\common\model\Mall;
/**
 * 公共
 * Class BaseService
 * @package app\service
 */
class BaseService{
    static protected $Instance=array();

    /**
     * @return $this
     */
    static public function S($option=false){
        if(!empty($option)) {
            if($option['mall_id']) {
                $mallInfo = Mall::getOneById($option['mall_id']);
                config($mallInfo);
                config('mall_id',$option['mall_id']);
                config(MallConfig::getConfig($option['mall_id']));
            }
        }
       $class=get_called_class();
       if(!isset(self::$Instance[$class]))
           self::$Instance[$class]=new $class($option);
       return self::$Instance[$class];
    }
}